//
//  Broker.m
//  命令模式
//
//  Created by flannery on 2018/12/19.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "Broker.h"
@interface Broker ()
@property (nonatomic ,strong) NSMutableArray * orderList;
@end
@implementation Broker

- (NSMutableArray *)orderList{
    if(!_orderList) {
        _orderList = [[NSMutableArray alloc]init];
    }
    return _orderList;
}

-(void)takeOrder:(Order*)order{
    [self.orderList addObject:order];
}
-(void)placeOrders{
    for (Order *order in self.orderList) {
        [order execute];
    }
    [self.orderList removeAllObjects];
}
@end
